package com.java1224;

public class Java02 {
    public static void main(String[] args) {
        // 数组；元素存取，数组遍历

        // 创建方式  1.已经知道数据
        int[] arr={1,2,3,3};
        //2.知道元素个数
        int[] arr1= new int[4];

        //元素存取
        int[] crr = {4,7,9,3};
        System.out.println(crr[2]);
        int x= crr[2];
        crr[1] = 6;

        int temp = crr[2];
        crr[2] = crr[3];
        crr[3] =temp;
        System.out.println(crr[2]);
        System.out.println(crr[3]);

        //1.数组遍历,下标
        for(int i=0;i<crr.length;i++){
            System.out.print(crr[i]);
        }
        //2.数组遍历 加强for循环
        for(int a:crr){
            System.out.print(a);
        }
    }
}
